package com.link.gateway.base.allowurl.controller;

import javax.annotation.Resource;

import com.link.gateway.core.filter.global.LinkTokenGlobalFilter;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


import java.util.HashMap;
import java.util.Map;

/**
 * url管理-不拦截URL
 *
 * @author 郭闪
 * @date 2019/07/22 15:56
 */
@RestController
@RequestMapping("/gateway/allowUrl")
public class AllowUrlController {


    @Resource
    private LinkTokenGlobalFilter tokenGlobalFilter;



    /**
     * @author  guoshan
     * 更新LinkTokenGlobalFilter 中的urlSet属性
     * @return
     */
    @RequestMapping("updateProperties")
    public Map<String,Object> updateProperties() {
        Map<String,Object> result = new HashMap<>(6);
        try {
            tokenGlobalFilter.setUrlSet();
        } catch (Exception e) {
            result.put("success",false);
            result.put("result",e.getMessage());
            return result;
        }
        result.put("success",true);
        return result;
    }

}
